<!--
描述：教学管理-专业信息维护组件
开发人：hqj
开发日期：2018年7月31日
-->
<template lang="pug">
    div.kalix-article
        keep-alive
            el-row.frame-row(:gutter="10")
                el-col.frame-col(:span="5")
                    kalix-tree(v-bind:treeDataURL="orgUrl" v-bind:parentNodeId="orgId" v-on:nodeClick="onOrgTreeClick")
                el-col.frame-col(:span="19")
                    kalix-table.duty-wrapper(ref="kalixBaseTable"
                    bizKey="majorInfo" title='专业信息列表' v-bind:targetURL="targetURL" v-bind:bizDialog="bizDialog"
                    v-bind:btnList="btnList" bizSearch="MajorInfoSearch" v-bind:dialogOptions="dialogOptions"
                    v-bind:dictDefine="dictDefine" v-bind:isFixedColumn="isFixedColumn")
                        template(slot="tableColumnSlot")
                            el-table-column(prop="orgName" label="所属院(系)部名称" align="center" width="200px")
                            el-table-column(prop="code" label="专业代码" align="center" width="120px")
                            el-table-column(prop="standardCode"  label="国标专业代码" align="center" width="120px")
                            el-table-column(prop="cnName" label="中文名称" align="center" width="200px")
                            el-table-column(prop="enName" label="英文名称" align="center" width="200px")
                            el-table-column(prop="subjectTypeName" label="所属学科" align="center" width="150px")
                            el-table-column(prop="period" label="学制" align="center" width="120px")
                            el-table-column(prop="trainingLevel" label="培养层次" align="center" width="120px")
                            el-table-column(prop="available" label="状态" align="center" width="120px")
                                template(slot-scope="scope")
                                    el-tag(v-if="scope.row.available * 1 === 0") 不可用
                                    el-tag(v-else type="success") 可用
                            el-table-column(prop="degree" label="授予学位" align="center" width="150px")
                            el-table-column(prop="normalClass" label="师范类" align="center" width="150px")
                            el-table-column(prop="minorRepair" label="允许辅修" align="center" width="150px")
                            kalix-date-column(prop="settingYear" label="设置年份" align="center" width="150px")
</template>

<script type="text/ecmascript-6">
    import {orgURL, TeachingUnitOrgID, ToolButtonList} from '../../config.toml'

    export default {
        name: 'kalix-admin-majorinfo',
        data() {
            return {
                dictDefine: [
                    { // 定义数据字典的显示
                        cacheKey: 'ADMIN-DICT-KEY',
                        type: '学科',
                        targetField: 'subjectTypeName',
                        sourceField: 'subjectType'
                    }
                ],
                btnList: ToolButtonList,
                bizDialog: [
                    {id: 'view', dialog: 'MajorInfoView'},
                    {id: 'edit', dialog: 'MajorInfoAdd'},
                    {id: 'add', dialog: 'MajorInfoAdd'}
                ],
                targetURL: '',
                orgUrl: orgURL,
                orgId: TeachingUnitOrgID,
                orgName: '',
                dialogOptions: {},
                isFixedColumn: true
            }
        },
        components: {},
        created() {
        },
        methods: {
            onOrgTreeClick(data) {
                this.orgId = data.id
                this.orgName = data.name
                this.targetURL = `/camel/rest/orgs/${data.id}/majorinfos`
                this.dialogOptions = {
                    orgId: this.orgId,
                    orgName: this.orgName,
                    targetURL: this.targetURL
                }
            }
        }
    }
</script>

<style scoped lang="stylus">
</style>
